package com.sghd.fight.module.game.config;

import com.sghd.common.ramcache.IEntity;
import com.sghd.common.ramcache.anno.Cached;
import com.sghd.common.ramcache.anno.CachedSizes;
import com.sghd.common.ramcache.anno.Persister;
import com.sghd.common.ramcache.anno.Persisters;
import com.sghd.pojo.fight.game.RoomType;

import javax.persistence.*;

/**
 * @author frank
 * @date 2018-10-22 17:33
 * @desc 房间配置
 **/
@Entity
@Table(catalog = "bsdld_fight")
@Cached(size = CachedSizes.DEFAULT, persister = @Persister(Persisters.PRE_HOUR))
public class RoomConfig implements IEntity<RoomType> {
    @Id
    @Enumerated(EnumType.STRING)
    @Column(name = "id", length = 50)
    private RoomType id;

    /** 每回合时间*/
    private int roundTime;
    /** 棋盘列*/
    private int col;
    /** 棋盘行*/
    private int row;
    /** 玩家人数*/
    private int playerCount;
    /** 最少消除数*/
    private int elimCount;
    /** 匹配间隔时间*/
    private long matchInterval;

    @Override
    public RoomType getId() {
        return id;
    }

    public void setId(RoomType id) {
        this.id = id;
    }

    public int getRoundTime() {
        return roundTime;
    }

    public void setRoundTime(int roundTime) {
        this.roundTime = roundTime;
    }

    public int getCol() {
        return col;
    }

    public void setCol(int col) {
        this.col = col;
    }

    public int getRow() {
        return row;
    }

    public void setRow(int row) {
        this.row = row;
    }

    public int getPlayerCount() {
        return playerCount;
    }

    public void setPlayerCount(int playerCount) {
        this.playerCount = playerCount;
    }

    public int getElimCount() {
        return elimCount;
    }

    public void setElimCount(int elimCount) {
        this.elimCount = elimCount;
    }

    public RoomConfig copy() {
        RoomConfig config = new RoomConfig();
        config.id = id;
        config.roundTime = roundTime;
        config.col = col;
        config.row = row;
        config.playerCount = playerCount;
        config.elimCount = elimCount;
        return config;
    }

    public long getMatchInterval() {
        return matchInterval;
    }

    public void setMatchInterval(long matchInterval) {
        this.matchInterval = matchInterval;
    }
}
